// 判断是否为 base64 字符串
export const base64RE = /data:(\w+)\/(\w+)+;base64,/i
// 根据后缀名判断类型
export const extStrRE = {
  image: /bmp|png|jpe?g|gif/i,
  audio: /mp3|wmv/i,
  video: /mp4/i,
  pdf: /pdf/i,
  word: /docx?/i
}
// 根据后缀名获取文件的 MIME
export const typeStrRE = {
  image: {
    bmp: /bmp/i,
    png: /png/i,
    jpg: /jpe?g/i,
    gif: /gif/i
  },
  audio: {
    mp3: /mp3/i,
    wmv: /wmv/i
  },
  video: {
    mp4: /mp4/i
  },
  application: {
    pdf: /pdf/i
  }
}

// @formatter:off
export const mimeType = [
  // {后缀名，MIME类型}
  { name: '.3gp', zhname: '.3gp', type: 'video/3gpp' },
  { name: '.apk', zhname: '.apk', type: 'application/vnd.android.package-archive' },
  { name: '.asf', zhname: '.asf', type: 'video/x-ms-asf' },
  { name: '.avi', zhname: '.avi', type: 'video/x-msvideo' },
  { name: '.bin', zhname: '.bin', type: 'application/octet-stream' },
  { name: '.bmp', zhname: '.bmp', type: 'image/bmp' },
  { name: '.c', zhname: '.c', type: 'text/plain' },
  { name: '.class', zhname: '.class', type: 'application/octet-stream' },
  { name: '.conf', zhname: '.conf', type: 'text/plain' },
  { name: '.cpp', zhname: '.cpp', type: 'text/plain' },
  { name: '.doc', zhname: '.doc', type: 'application/msword' },
  { name: '.docx', zhname: '.docx', type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' },
  { name: '.xls', zhname: '.xls', type: 'application/vnd.ms-excel' },
  { name: '.xlsx', zhname: '.xlsx', type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' },
  { name: '.exe', zhname: '.exe', type: 'application/octet-stream' },
  { name: '.gif', zhname: '.gif', type: 'image/gif' },
  { name: '.gtar', zhname: '.gtar', type: 'application/x-gtar' },
  { name: '.gz', zhname: '.gz', type: 'application/x-gzip' },
  { name: '.h', zhname: '.h', type: 'text/plain' },
  { name: '.htm', zhname: '.htm', type: 'text/html' },
  { name: '.html', zhname: '.html', type: 'text/html' },
  { name: '.jar', zhname: '.jar', type: 'application/java-archive' },
  { name: '.java', zhname: '.java', type: 'text/plain' },
  { name: '.jpeg', zhname: '.jpeg', type: 'image/jpeg' },
  { name: '.jpg', zhname: '.jpg', type: 'image/jpeg' },
  { name: '.js', zhname: '.js', type: 'application/x-javascript' },
  { name: '.log', zhname: '.log', type: 'text/plain' },
  { name: '.m3u', zhname: '.m3u', type: 'audio/x-mpegurl' },
  { name: '.m4a', zhname: '.m4a', type: 'audio/mp4a-latm' },
  { name: '.m4b', zhname: '.m4b', type: 'audio/mp4a-latm' },
  { name: '.m4p', zhname: '.m4p', type: 'audio/mp4a-latm' },
  { name: '.m4u', zhname: '.m4u', type: 'video/vnd.mpegurl' },
  { name: '.m4v', zhname: '.m4v', type: 'video/x-m4v' },
  { name: '.mov', zhname: '.mov', type: 'video/quicktime' },
  { name: '.mp2', zhname: '.mp2', type: 'audio/x-mpeg' },
  { name: '.mp3', zhname: '.mp3', type: 'audio/x-mpeg' },
  { name: '.mp3', zhname: '.mp3', type: 'audio/mp3' },
  { name: '.mp4', zhname: '.mp4', type: 'video/mp4' },
  { name: '.mpc', zhname: '.mpc', type: 'application/vnd.mpohun.certificate' },
  { name: '.mpe', zhname: '.mpe', type: 'video/mpeg' },
  { name: '.mpeg', zhname: '.mpeg', type: 'video/mpeg' },
  { name: '.mpg', zhname: '.mpg', type: 'video/mpeg' },
  { name: '.mpg4', zhname: '.mpg4', type: 'video/mp4' },
  { name: '.mpga', zhname: '.mpga', type: 'audio/mpeg' },
  { name: '.msg', zhname: '.msg', type: 'application/vnd.ms-outlook' },
  { name: '.ogg', zhname: '.ogg', type: 'audio/ogg' },
  { name: '.pdf', zhname: '.pdf', type: 'application/pdf' },
  { name: '.png', zhname: '.png', type: 'image/png' },
  { name: '.pps', zhname: '.pps', type: 'application/vnd.ms-powerpoint' },
  { name: '.ppt', zhname: '.ppt', type: 'application/vnd.ms-powerpoint' },
  { name: '.pptx', zhname: '.pptx', type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' },
  { name: '.prop', zhname: '.prop', type: 'text/plain' },
  { name: '.rc', zhname: '.rc', type: 'text/plain' },
  { name: '.rmvb', zhname: '.rmvb', type: 'audio/x-pn-realaudio' },
  { name: '.rtf', zhname: '.rtf', type: 'application/rtf' },
  { name: '.sh', zhname: '.sh', type: 'text/plain' },
  { name: '.tar', zhname: '.tar', type: 'application/x-tar' },
  { name: '.tgz', zhname: '.tgz', type: 'application/x-compressed' },
  { name: '.txt', zhname: '.txt', type: 'text/plain' },
  { name: '.wav', zhname: '.wav', type: 'audio/x-wav' },
  { name: '.wma', zhname: '.wma', type: 'audio/x-ms-wma' },
  { name: '.wmv', zhname: '.wmv', type: 'audio/x-ms-wmv' },
  { name: '.wps', zhname: '.wps', type: 'application/vnd.ms-works' },
  { name: '.xml', zhname: '.xml', type: 'text/plain' },
  { name: '.z', zhname: '.z', type: 'application/x-compress' },
  { name: '.zip', zhname: '.zip', type: 'application/x-zip-compressed' },
  { name: '.zip', zhname: '.zip', type: 'application/zip' },
  { name: '', zhname: '', type: '*/*' }
]
// @formatter:on
